package com.kaizige.realtor.Controller;

import com.kaizige.realtor.Dao.houseOwnerDao;
import com.kaizige.realtor.Dao.tenantDao;
import com.kaizige.realtor.Pojo.houseOwner;
import com.kaizige.realtor.Pojo.tenant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class registerController {
	@Autowired
	tenantDao td;
	@Autowired
	houseOwnerDao hod;

	@RequestMapping("/toOwnReg")
	public String toOwnReg(){
		return "/reg/ownRegister";
	}
	
	@RequestMapping("/toTenReg")
	public String toTenReg(){
		return "/reg/tenRegister";
	}
	
	@RequestMapping("/TenRegister")
	public String tenRegister(tenant t){
		td.addTen(t);
		return "redirect:/";
	}
	@RequestMapping("/OwnRegister")
	public String ownRegister(houseOwner ho){
		hod.addOwn(ho);
		return "redirect:/";
	}
	
}
